package com.xiaoy.core.base.dictionary.service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.springframework.stereotype.Service;

import com.xiaoy.util.store.io.ReadFileUtil;

@Service("dictionaryFileService")
public class DictionaryFileService {

	private static Map<String ,List<String>> vs = new HashMap<String, List<String>>();
	
	private static DictionaryFileService store = new DictionaryFileService();
	
	
	private DictionaryFileService () {
//		ReadFileUtil.readProperties("/dictionary");
		init();
	}
	
	private void init () {
		
		Map<String,String>map = ReadFileUtil.readDirProperties("dictionary");
		
		for (Entry<String, String> entry:map.entrySet()) {
			String value = entry.getValue();
			vs.put(entry.getKey(), Arrays.asList(value.split(",")));
		}
	}
	
//	public List<String> getValue (String key) {
//		return vs.get(key);
//	}
	
	public static List<String> getValue(String key) {
		return vs.get(key);
	}
	
	public static Map<String,List<String>> getAllValue () {
		return vs;
	}
	
}
